package com.neiquan.backstage.platform_system_config.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.neiquan.backstage.common.util.ExtraSpringHibernateTemplate;
import com.neiquan.backstage.platform_system_config.PlatformSystemConfigService;
import com.neiquan.backstage.pub.bsc.dao.po.PlatformSystemConfig;

@Service
public class PlatformSystemConfigServiceImpl implements PlatformSystemConfigService {
	private static Class<?> poc = PlatformSystemConfig.class;
	@Autowired
	private ExtraSpringHibernateTemplate extraSpringHibernateTemplate;

	@Override
	public void init() {
		PlatformSystemConfig entity = new PlatformSystemConfig();
		entity.setConfigId(default_config_id);
		extraSpringHibernateTemplate.getHibernateTemplate().save(entity);
	}

	@Override
	public PlatformSystemConfig queryById(Integer id) {
		return extraSpringHibernateTemplate.findFirstOneByPropEq(poc, "configId", id);
	}

	@Override
	public PlatformSystemConfig query() {
		return queryById(default_config_id);
	}
}
